-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[dart-dio] Fix compile error in enum properties with "default" values (#20495) #21355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Do we have this in one of the samples? Probably not... |
I didn't see it, but we can try to add it: OpenAPI spec: {
"openapi": "3.1.0",
"info": {
"title": "Simple",
"version": "0.0.1"
},
"paths": {},
"components": {
"schemas": {
"TestEnum": {
"type": "string",
"enum": [
"",
"1",
"2"
],
"title": "TestEnum"
},
"TestItem": {
"properties": {
"test": {
"type": "integer",
"title": "test"
},
"testEmum": {
"$ref": "#/components/schemas/TestEnum",
"default": ""
}
},
"type": "object",
"required": [
"test"
],
"title": "TestItem"
}
}
},
"tags": []
} And problem will be here: @BuiltValueHook(initializeBuilder: true)
static void _defaults(TestItemBuilder b) => b
..testEmum = const ._(TestEnum.empty); |
@ahmednfwela would be great to get this reviewed ASAP please because it affects us too. |
@wing328 can this case be added to any of the samples we use? unfortunately they are all shared with other generators |
@chizhanov did you test it locally to confirm it works for you? i can add a test or 2 later using a dedicated for dart client tests. |
i just merged #21516 to the master to have dart dedicated test spec (fake petstore) can you please merge the latest master into your branch and add a test schema with enum properties (with default values) and regenerate the samples (step 3 in pr checklist) when you've time? dart test spec: |
@wing328 Yes, I tested these changes and in my cases they fixed the problem and did not cause new ones. I added a test to petstore as you asked. |
1bb620e
to
09c61e4
Compare
This PR solves the problem described in #20495.
I made this fix locally and on my openapi the issue was fixed and no new issues were found.
@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)